local httparg    = require("shared.api.httparg")
local response   = require("shared.api.response")
local tag        = httparg.tag()
local assertion  = httparg.assertion


local ARGS = {
  -- exist body?
  tag.body('json', 'required'),

  type     = tag.json.type        ('string', 'required', assertion.non_empty_string()),
  coin     = tag.json.coin        ('string'            , assertion.non_empty_string()),
  account  = tag.json.account     ('string'            , assertion.non_empty_string()),
  username = tag.json.username    ('string'            , assertion.non_empty_string()),
}



local RESULT
do
  local dataapi   = require("shared.api.dataapi")

  local reply, err = dataapi.account.view_vip_bonus(
    {
      type      = ARGS.type,
      coin      = ARGS.coin,
      account   = ARGS.account,
      username  = ARGS.username,
    })

  if err then
    response.error(err)
  end

  -- export
  RESULT = reply
end

-- response
response.success(RESULT)
